package fp.poczadly.client.view;

import com.google.gwt.event.dom.client.HasClickHandlers;
import com.google.gwt.user.client.ui.Button;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.HasValue;
import com.google.gwt.user.client.ui.Label;
import com.google.gwt.user.client.ui.TextBox;
import com.google.gwt.user.client.ui.VerticalPanel;
import com.google.gwt.user.client.ui.Widget;

import fp.poczadly.client.presenter.LoginPresenter.Display;
import fp.poczadly.shared.Utils;

public class LoginView extends Composite implements Display {

	private final Button loginButton;
	
	private final TextBox usernameTextField;
	
	public LoginView() {
		VerticalPanel vPanel = new VerticalPanel();
		
		Label label = new Label( Utils.USERNAME );
		
		usernameTextField = new TextBox();
		loginButton = new Button( Utils.LOG_IN );
		
		vPanel.add( label );
		vPanel.add( usernameTextField );
		vPanel.add( loginButton );
		
		this.initWidget( vPanel );
	}
	
	@Override
	public HasClickHandlers loginButton() {
		return loginButton;
	}

	@Override
	public HasValue<String> usernameTextField() {
		return usernameTextField;
	}
	
	@Override
	public Widget asWidget() {
		return this;
	}

}
